﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using UtilZ.Dotnet.Ex.Base;
using UtilZ.Dotnet.Ex.Model;

namespace UtilZ.Dotnet.Ex.Communication.Net.Web
{
    /// <summary>
    /// Form数据
    /// </summary>
    public class HttpFormData : IDisposable
    {
        private ReadOnlyCollection<HttpFile> _files;
        /// <summary>
        /// 文件列表
        /// </summary>
        public ReadOnlyCollection<HttpFile> Files
        {
            get { return _files; }
        }


        /// <summary>
        /// 构造函数 
        /// </summary>
        /// <param name="files">文件列表</param>
        public HttpFormData(IList<HttpFile> files)
        {
            this._files = new ReadOnlyCollection<HttpFile>(files);
        }


        /// <summary>
        /// Dispose
        /// </summary>
        /// <exception cref="NotImplementedException"></exception>
        public void Dispose()
        {
            if (this._files != null)
            {
                foreach (var file in this._files)
                {
                    file.Dispose();
                }
                this._files = null;
            }
        }
    }
}
